import { createApp } from "vue";
import App from "./App.vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { createPinia } from "pinia";
import { useLogStore } from "./store/logStore";

const app = createApp(App);
const pinia = createPinia();

// 注册所有Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(ElementPlus);
app.use(pinia);

// 初始化 logStore
const logStore = useLogStore(pinia);

// 添加全局日志记录函数
window.logToStore = (message) => {
  if (logStore) {
    logStore.addMessage(message);
  }
};

app.mount("#app");
